****************************************************************************************************************************************************
***Analysis of Voxmeter data for Pedersen, Hansen and Pedersen: "Citizens' Aversion to Pay Raises for Politicians" *********************************
****************************************************************************************************************************************************
***Written for STATA 15 ****************************************************************************************************************************
****************************************************************************************************************************************************


**********************************
***Installing required packages***
**********************************
* ssc install estout //Run this line if estout is not already installed (used when creating regression tables)
* ssc install coefplot //Run this line if "Coefplot" is not already installed (used when plotting results in graphs)
* ssc install blindschemes //Run this line if "blindschemes is not already installed (used to control graph layout) 


*******************************
***Setting the figure scheme***
*******************************
set scheme plotplain
graph set window fontface garamond


**********************
***Getting the data***
**********************
clear all
set more off, permanently
cd "C:\Citzensaversion"
use "C:\Citzensaversion\citizens_aversion_anom.dta"



*Attaching variable labels
label variable Completed 			"Did the respondent complete the questionnaire"
label variable Gender_3				"Gender"		
label variable Occupation			"Occupation"
label variable Q1					"Partychoice"
label variable Q2					"Left_right"
label variable Q3_SQ_0				"Ineq_fairness"
label variable Q3_SQ_1				"Ineq_talent"
label variable Q3_SQ_2				"Ineq_Denmark"
label variable Q4					"Skill_uniq_politician"
label variable Q5					"Skill_uniq_CEO"
label variable Q6					"Skill_uniq_professor"
label variable Q7					"Skill_uniq_permsectretary"
label variable Q8					"Trust_general"
label variable Q9_SQ_0				"Trust_competent"
label variable Q9_SQ_1				"Trust-personalgain"
label variable Q10_SQ_0				"Intelligent"
label variable Q10_SQ_1				"Dygtig"
label variable Q10_SQ_2				"Meget vidende"
label variable Q10_SQ_3				"Hårdtarbejdende"
label variable Q10_SQ_4				"Sympatisk"
label variable Q10_SQ_5				"Samvittighedsfuld"
label variable Q10_SQ_6				"Venlig"
label variable Q10_SQ_7				"Omsorgsfuld"
label variable Q11_SQ_0				"De fleste folketingspolitikere er intelligente"
label variable Q11_SQ_1				"De fleste folketingspolitikere er dygtige"
label variable Q11_SQ_2				"De fleste folketingspolitikere ved meget"
label variable Q11_SQ_3				"De fleste folketingspolitikere er hårdtarbejdende"
label variable Q11_SQ_4				"De fleste folketingspolitikere er sympatiske"
label variable Q11_SQ_5				"De fleste folketingspolitikere er samvittighedsfulde"
label variable Q11_SQ_6				"De fleste folketingspolitikere er venlige"
label variable Q11_SQ_7				"De fleste folketingspolitikere er omsorgsfulde"
label variable PickCondition		"Condition"
label variable Q12_A				"Exp_noargument"
label variable Q12_B				"Exp_compargument"
label variable Q12_C				"Exp_warmthargument"
label variable Q12_D1				"Exp_comp_then_warmth"
label variable Q12_D2				"Exp_warmth_then_comp"
label variable Q12_Result			"Support_increase"
label variable PB_Age				"Age"
label variable PB_Region			"Region"
label variable PB_Higher_Education	"Education"


	

*************************
***Setting up the data***
*************************

*Pre-treatment variables

	*Gender
	label define gender 1 "Man" 2 "Women" 3 "Other"
	label values Gender_3 gender
	recode Gender_3 (2=1) (else=0), gen(Female)
	label variable Female "Female"
	
	*Occupation
	recode Occupation 	(1=1 "Self-employed") ///
						(2=2 "Employed, Public sector") ///
						(3=3 "Employed, Private sector") ///
						(4=4 "Unemployed") ///
						(5=5 "Student") ///
						(6=6 "On leave") ///
						(7=7 "Retired") ///
						(8=8 "Assisting spouse") ///
						(9=9 "Homemaker") ///
						(10=10 "Don't know/No answer") ///
						, gen(Occupation10)
	recode Occupation 	(1/3=1) (else=0), gen(Employed)
	
	drop Occupation
	
	*Age
	rename PB_Age Age
	
	*Geographical Region
	recode PB_Region (1=1 "Hovedstaden") (2=2 "Sjælland") (3=3 "Syddanmark") (4=4 "Midtjylland") (5=5 "Nordjylland"), gen(Region)
	drop PB_Region
	
	*Education
	recode PB_Higher_Education 	(1=1 "School, basic") ///
								(2 3=2 "High School") ///
								(4=3 "Vocational") ///
								(5=4 "Short tert.") ///
								(6=5 "medium tert.") ///
								(7 8 =6 "long tert.") ///
								(else=7 "Other"), gen(education) 
								
	recode education			(1/2=1 "High School or less") (3=2 "Vocational") (4/6=3 "Some college") (7=7 "Other") , gen(edu3)
	recode education 			(4/6=1 "Some college") (else=0 "No college"), gen(Some_college)
	drop PB_Higher_Education 	
	
	*Party Choice
	recode Q1	(1=1  		"A: Social Democrats") ///
				(2=2  		"B: Social Liberals") ///
				(3=3  		"C: Conservatives") ///
				(4=4  		"D: New right") ///
				(5=5  		"E: Citizens List") ///
				(6=6  		"F: Socialist People's Party") ///
				(7=7  		"I: Liberal Alliance") ///
				(8=8  		"O: Danish People's Party") ///
				(9=9 		"P: Hard Line") ///
				(10=10  	"V: Liberals") /// 
				(11=11 		"Ø: Unity List") ///
				(12=12		"Å: The Alternative") ///
				(13=13		"Other party/candidate") ///
				(14=14		"Would not vote") ///
				(15=15		"Would cast blank wote") ///
				(16=16		"Other / Don't Know") ///
				, gen(Partychoice)
				drop Q1
	
	recode Partychoice 	(1 2 6 11 12=0 "Center-left") ///
						(3 4 5 7 8 9 10=1 "Center-right") ///
						(13=2 "Other / Don't know") ///
						, gen(pol_block)
	
	
	
	
	*Left-Right
	recode Q2 (11=.), gen(uns_LR)
	generate LR=uns_LR/10
	drop Q2
		
	*Inequality Aversion
	recode Q3_SQ_0 (6=.), gen(Ineq_fairness)
	drop Q3_SQ_0 
	recode Q3_SQ_1 (6=.), gen(Ineq_talent)
	drop Q3_SQ_1 
	recode Q3_SQ_2 (6=.), gen(Ineq_Denmark)
	drop Q3_SQ_2 
	
	factor LR Ineq_fairness Ineq_talent Ineq_Denmark
	alpha LR Ineq_fairness Ineq_talent Ineq_Denmark, item std gen(uns_inequality_attitude) //Internal reliability is acceptable
	egen uns_inequality_attitude_min=min(uns_inequality_attitude) //these lines standardize the measure to 0-1
	egen uns_inequality_attitude_max=max(uns_inequality_attitude) //these lines standardize the measure to 0-1
	gen inequality_attitude=(uns_inequality_attitude-uns_inequality_attitude_min)/(uns_inequality_attitude_max-uns_inequality_attitude_min) //these lines standardize the measure to 0-1
	label variable inequality_attitude "Economic Inequality Attitude Index (aversion)"
	
	*Skill Uniqueness (direction is reversed such that value denotes high skill uniqeness)
	recode Q4 (8=.), gen(uns_skill_uniq_politician)
	gen skill_uniq_politician=1-((uns_skill_uniq_politician-1)/6)
	drop Q4
	recode Q5 (8=.), gen(uns_skill_uniq_CEO)
	gen skill_uniq_CEO=1-((uns_skill_uniq_CEO-1)/6)
	drop Q5
	recode Q6 (8=.), gen(uns_skill_uniq_professor)
	gen skill_uniq_professor=1-((uns_skill_uniq_professor-1)/6)
	drop Q6
	recode Q7 (8=.), gen(uns_skill_uniq_permsecretary)
	gen skill_uniq_permsecretary=1-((uns_skill_uniq_permsecretary-1)/6)
	drop Q7
	*Skill uniqueness, alternative measure for politicians 
	gen uns_skill_uniq_politician_alt=skill_uniq_politician-((skill_uniq_CEO+skill_uniq_professor+skill_uniq_permsecretary)/3)
	egen uns_skill_uniq_alt_min=min(uns_skill_uniq_politician_alt) //these lines standardize the measure to 0-1
	egen uns_skill_uniq_alt_max=max(uns_skill_uniq_politician_alt) //these lines standardize the measure to 0-1
	gen skill_uniq_politician_alt=(uns_skill_uniq_politician_alt-uns_skill_uniq_alt_min)/(uns_skill_uniq_alt_max-uns_skill_uniq_alt_min) //these lines standardize the measure to 0-1
	
	
	
	*Trust, politicians in parliament
	recode Q8 (11=.), gen(uns_Trust_polpar)
	gen Trust_polpar=uns_Trust_polpar/10
	label variable Trust_polpar "Trust politicians in parliament"
	drop Q8

	*Trust, politicians competent people
	recode Q9_SQ_0 (6=.), gen(uns_Trust_comp)
	gen Trust_comp=(uns_Trust_comp-1)/4
	drop Q9_SQ_0
	
	*Trust, politicians out for themselves
	recode Q9_SQ_1 (6=.), gen(uns_Trust_themselves)
	gen Trust_themselves=(uns_Trust_themselves-1)/4 
	drop Q9_SQ_1
	
	*Trust, index
	alpha Trust_polpar Trust_comp Trust_themselves, item std gen(uns_Trust_index)

	egen uns_Trust_index_min=min(uns_Trust_index) //these lines standardize the measure to 0-1
	egen uns_Trust_index_max=max(uns_Trust_index) //these lines standardize the measure to 0-1
	gen Trust_index=(uns_Trust_index-uns_Trust_index_min)/(uns_Trust_index_max-uns_Trust_index_min) //these lines standardize the measure to 0-1
	label variable Trust_index "Political trust index"

	*Trait importance 
		*Competence Importance
		recode Q10_SQ_0 (6=.), gen(Imp_intelligent)
		recode Q10_SQ_1 (6=.), gen(Imp_skilled)
		recode Q10_SQ_2 (6=.), gen(Imp_Knowledgeable)
		recode Q10_SQ_3 (6=.), gen(Imp_Hardworking)
		alpha Imp_intelligent Imp_skilled Imp_Knowledgeable Imp_Hardworking, item std gen(uns_imp_competence)
		egen uns_imp_competence_min=min(uns_imp_competence) //these lines standardize the measure to 0-1
		egen uns_imp_competence_max=max(uns_imp_competence) //these lines standardize the measure to 0-1
		gen imp_competence=(uns_imp_competence-uns_imp_competence_min)/(uns_imp_competence_max-uns_imp_competence_min) //these lines standardize the measure to 0-1
		label variable imp_competence "Competence importance"
	
		*Warmth Importance
		recode Q10_SQ_4 (6=.), gen(Imp_Likeable)
		recode Q10_SQ_5 (6=.), gen(Imp_Conscientious)
		recode Q10_SQ_6 (6=.), gen(Imp_Friendly)
		recode Q10_SQ_7 (6=.), gen(Imp_Caring)
		alpha Imp_Likeable Imp_Conscientious Imp_Friendly Imp_Caring, item std // Imp_Conscientious lower reliability and should be removed! (but consider "symmetry")
		alpha Imp_Likeable Imp_Conscientious Imp_Friendly Imp_Caring, item std gen(uns_imp_warmth) 
		egen uns_imp_warmth_min=min(uns_imp_warmth) //these lines standardize the measure to 0-1
		egen uns_imp_warmth_max=max(uns_imp_warmth) //these lines standardize the measure to 0-1
		gen imp_warmth=(uns_imp_warmth-uns_imp_warmth_min)/(uns_imp_warmth_max-uns_imp_warmth_min) //these lines standardize the measure to 0-1
		label variable imp_warmth "Warmth importance"
				
	drop Q10_SQ_?
	
	*Trait perceptionss
		*Competence Perception
		recode Q11_SQ_0 (6=.), gen(intelligent)
		recode Q11_SQ_1 (6=.), gen(skilled)
		recode Q11_SQ_2 (6=.), gen(Knowledgeable)
		recode Q11_SQ_3 (6=.), gen(Hardworking)
		alpha intelligent skilled Knowledgeable Hardworking, item std gen(uns_competence)
		egen uns_competence_min=min(uns_competence) //these lines standardize the measure to 0-1
		egen uns_competence_max=max(uns_competence) //these lines standardize the measure to 0-1
		gen competence=(uns_competence-uns_competence_min)/(uns_competence_max-uns_competence_min) //these lines standardize the measure to 0-1
		label variable competence "Perceived competence"

		
		*Warmth Importance
		recode Q11_SQ_4 (6=.), gen(Likeable)
		recode Q11_SQ_5 (6=.), gen(Conscientious)
		recode Q11_SQ_6 (6=.), gen(Friendly)
		recode Q11_SQ_7 (6=.), gen(Caring)
		alpha Likeable Conscientious Friendly Caring, item std gen(uns_warmth)
		egen uns_warmth_min=min(uns_warmth) //these lines standardize the measure to 0-1
		egen uns_warmth_max=max(uns_warmth) //these lines standardize the measure to 0-1
		gen warmth=(uns_warmth-uns_warmth_min)/(uns_warmth_max-uns_warmth_min) //these lines standardize the measure to 0-1
		label variable warmth "Perceived warmth"
		
	drop Q11_SQ_?
	
	
*Experimental conditions
	label define Conditions5 1 "A: No argument" 2 "B: Competence argument" 3 "C: Self-interest argument" 4 "D1: Competence then Self-interest" 5 "D2: Self-interest then Competence"
	label values PickCondition Conditions5
 
	recode PickCondition (1=1) (2=2) (3=3) (4 5=4), gen(Conditions)
	label define Conditions4 1 "A: No argument" 2 "B: Competence argument" 3 "C: Self-interest argument" 4 "D: Competence and Self-interest" 
	label values Conditions Conditions4

	drop Q12_A Q12_B Q12_C Q12_D1 Q12_D2

*Post-treatment variables	
recode Q12_Result (6=.), gen(uns_Support_increase)
gen Support_increase=(uns_Support_increase-1)/4
gen Support_increase_cat=Q12_Result 
drop Q12_Result 



drop uns_*
		

***************************************************************************************************************************************************************************************
***ANALYSES****************************************************************************************************************************************************************************
***************************************************************************************************************************************************************************************

************************************
***Respondent Descriptives**********
************************************

tab Completed // Overall completion rate was 97.45%
tab Completed if PickCondition!=. // Just 0.08% attrition rate among respondents exposed to stimuli
tab Completed PickCondition, chi //Obviously no significant differences in attrition across conditions

tab Gender_3 if Completed==1
tab Female if Completed==1
sum Age if Completed==1
tab Region if Completed==1
tab education if Completed==1
tab edu3 if Completed==1
tab Some_college if Completed==1
tab Occupation10 if Completed==1
tab Employed if Completed==1
tab Partychoice if Completed==1
tab Partychoice if Completed==1 & Partychoice!=14 & Partychoice!=15 & Partychoice!=16
tab pol_block if Completed==1
tab pol_block if Completed==1 & Partychoice!=14 & Partychoice!=15 & Partychoice!=16
tab LR if Completed==1
sum LR if Completed==1


estpost summarize inequality_attitude Trust_index warmth competence imp_warmth imp_competence skill_uniq_politician Support_increase
esttab 	. using descriptives.rtf, cells("count(label(N)) mean(label(Mean) fmt(%9.2f)) sd(label(SD) fmt(%9.2f)) min(label(Min)) max(label(Max))") ///
		noobs nonumbers replace ///
		varlabels( inequality_attitude "Inequality attitude (aversion)" Trust_index "Trust in Politicians" warmth "Warmth" competence ///
		"Competence" imp_warmth "Importance of warmth" imp_competence "Importance of competence" ///
		skill_uniq_politician " Skill Uniqueness of politicians" Support_increase "Support for proposal")

/*
kdensity warmth, 				title("Trust in Politicians' Warmth") note(" ") plotregion(lcolor(none)) ///
								ylabel(0(.5)2.5, labsize(medium) angle(0) gmax) ytitle(, size(medium))  xlabel(,labsize(medium)) xtitle(" ", size(zero))  graphregion(margin(top))
								graph save kdensity_warmth, replace
kdensity competence, 			title("Trust in Politicians Competence") note(" ") plotregion(lcolor(none)) ///
								ylabel(0(.5)2.5, labsize(medium) angle(0) gmax) ytitle(, size(medium))  xlabel(,labsize(medium)) xtitle(" ", size(zero))  graphregion(margin(top))
								graph save kdensity_competence, replace
kdensity imp_warmth, 			title("Importance of Warmth ") note(" ") plotregion(lcolor(none)) ///
								ylabel(0(.5)2.5, labsize(medium) angle(0) gmax) ytitle(, size(medium))  xlabel(,labsize(medium)) xtitle(" ", size(zero))  graphregion(margin(top))
								graph save kdensity_imp_warmth, replace
kdensity imp_competence,		title("Importance of Competence ") note(" ") plotregion(lcolor(none)) ///
								ylabel(0(.5)2.5, labsize(medium) angle(0) gmax) ytitle(, size(medium))  xlabel(,labsize(medium)) xtitle(" ", size(zero))  graphregion(margin(top))
								graph save kdensity_imp_competence, replace
graph combine 					kdensity_warmth.gph kdensity_competence.gph kdensity_imp_warmth.gph kdensity_imp_competence.gph, col(1) imargin(0 0 0 0) iscale(.5) ysize(6) xsize(6) plotregion(lcolor(black)) ///
								note("Note: The graphs shows the distributions of respondent values across the possible" "range of the variables (Epanechnikow kernel function)", size(small))
								graph export kdensity.tif, replace
*/
	

*************************************************************
***Attitude regarding proposed change in politicians' pay ***
*************************************************************

tab Support_increase Conditions, col
tab Support_increase_cat Conditions, col


*Models for hypothesis 1, 2 and 3
	
	*Simple model (model 1)
	*reg Support_increase i.PickCondition
	reg Support_increase i.Conditions
	eststo Primary
	margins, over(Condition) pwcompare(effects)
	margins, at(Conditions=(1 2 3 4)) post
	eststo simple
	
		estimates restore Primary
		margins, dydx(Conditions) post
		eststo simple_marginalfx
	
	
	*Model with covariates (Model 2)
	reg Support_increase i.Conditions Age Female inequality_attitude Trust_index warmth competence  imp_warmth imp_competence
	eststo Supplementary
	margins, over(Condition) pwcompare(effects)
	margins, at(Conditions=(1 2 3 4)) post
	eststo covariates
	
	*Figure
	coefplot   	(simple,  msymbol(circle) msize(large) mcolor(gs10)  mlcolor(black) ciopts(recast(rspike) color(black)) )  ///
				, vert ytitle("Support for Proposal", size(medlarge)) title("", size(large))  ///
				ylabel(0.2(.05).4,labsize(large) format(%9.2f)) xline(1.5 2.5 3.5, lcolor(gs10) lstyle(dot)) ///
				coeflabels 	(1._at= `" "A: No" "Argument" "'  /// 
							2._at= `" "B: Competence" "Argument" "' ///
							3._at= `" "C: Self-interest" "Argument" "' ///
							4._at= `" "D: Competence" "and Self-interest" "',  labsize(large) ) ///
				caption(" " "Note: Estimates with 95% confidence intervals (Based on model 1, appendix D)." ///
					"          ", span size(medlarge)) ///
						xsize(6.5) ysize(3.5)
			graph export FIG_1.eps, replace fontface(Garamond)
			
				coefplot   	(simple_marginalfx,  msymbol(circle) msize(large) mcolor(gs10)  mlcolor(black) ciopts(recast(rspike) color(black)) )  ///
							, vert ytitle("Marginal Effects", size(medlarge)) title("", size(large))  baselevels yline(0) ///
							ylabel(-0.12(.02).05,labsize(large) format(%9.2f)) xline(1.5 2.5 3.5, lcolor(gs10) lstyle(dot)) ///
							coeflabels 	(1.Conditions= `" "A: No" "Argument" "'  /// 
										2.Conditions= `" "B: Competence" "Argument" "' ///
										3.Conditions= `" "C: Self-interest" "Argument" "' ///
										4.Conditions= `" "D: Competence" "and Self-interest" "',  labsize(large) ) ///
							caption(" " "Note: Estimates with 95% confidence intervals (Based on model 1, appendix D)." ///
								"          ", span size(medlarge)) ///
									xsize(6.5) ysize(3.5)
							graph export FIG_D1.tif, replace 
	
	
	coefplot   	(simple,  msymbol(circle) msize(large) mcolor(gs16)  mlcolor(black) ciopts(recast(rspike) color(black)) offset(-.05) label(simple)) ///
				(covariates,  msymbol(circle) msize(large) mcolor(gs0)  mlcolor(black) ciopts(recast(rspike) color(black)) offset(.05) label(covariates) ) ///
				, vert ytitle("Support for Proposal", size(medlarge)) title("", size(large)) legend(cols(1)  subtitle("") position(4) size(medium) width(25)) ///
				ylabel(0.2(.05).4,labsize(large) format(%9.2f)) xline(1.5 2.5 3.5, lcolor(gs10) lstyle(dot)) ///
				coeflabels 	(1._at= `" "A: No" "Argument" "'  /// 
							2._at= `" "B: Competence" "Argument" "' ///
							3._at= `" "C: Self-interest" "Argument" "' ///
							4._at= `" "D: Competence" "and Self-interest" "',  labsize(large) ) ///
				caption(" " "Note: Estimates with 95% confidence intervals (Based on models 1 and 2, appendix D)." ///
					"          ", span size(medlarge)) ///
						xsize(6.5) ysize(3.5)
			graph export FIG_D2.tif, replace	
	
	*Hypothesis 1:"People become less opposed to higher salaries for politicians if exposed to the argument that higher salaries would attract competent politicians."
	*NOT SUPPORTED: Compared to the control condition, respondents becomes MORE opposed, although insignificantly so
	
	*Hypothesis 2:"People become more opposed to higher salaries for politicians if exposed to the argument that higher salaries would attract self-interested politicians."
	*SUPPORTED: Compared to the control condition, respondents becomes MORE opposed	
	
	*Hypothesis 3:"People are more affect by the argument that higher salaries attract self-interested politicians than the argument that higher salaries attract competent politicians."
	*SUPPORTED: Respondents become significantly more opposed to higher salaries in conditions C than B (and B was supposed to pull in the other direction). //
	*In addition, when given both arguments in condition D, respondents become significantly more opposed than in the condition A (control condition)	

	*Effect size - Comparing condition A and C
	 esize twosample Support_increase if Conditions!=2 & Conditions!=4, by(Conditions) all
	
	


***MODELS FOR HYPOTHESIS 4***	
		
	*H4A - INTERACTION WITH SKILL UNIQENESSS (model 4)
	reg Support_increase i.Conditions##c.skill_uniq_politician 
	eststo model_4
	*reg Support_increase i.Conditions##c.skill_uniq_politician Age Female inequality_attitude Trust_index warmth competence  imp_warmth imp_competence
	margins, dydx(skill_uniq_politician) // Significant main effect of "skill uniqueness"
	margins, dydx(skill_uniq_politician) at(Conditions=(1 2 3 4)) pwcompare(effects groups) // H4A NOT supported. Effect of "skill uniqueness" does not differ significantly across groups
	margins, dydx(skill_uniq_politician) at(Conditions=(1 2 3 4)) post
	eststo h4a

	sum skill_uniq_politician, detail
		
	estimates restore model_4
	margins, at(Conditions=(1 2 3 4) skill_uniq_politician=.2855239) post // 
	eststo low_skill
	
		estimates restore model_4
		margins, dydx(Conditions) at(skill_uniq_politician=.2855239) post // 
		eststo low_skill_marginalfx
	
	estimates restore model_4
	margins, at(Conditions=(1 2 3 4) skill_uniq_politician=.7302777) post // 
	eststo high_skill
		
		estimates restore model_4
		margins, dydx(Conditions) at(skill_uniq_politician=.7302777) post // 
		eststo high_skill_marginalfx
	
	
	coefplot   	(low_skill,  msymbol(circle) msize(large) mcolor(gs16)  mlcolor(black) ciopts(recast(rspike) color(black)) offset(-.05) label("Low Skill" "Uniqueness")) ///
				(high_skill,  msymbol(circle) msize(large) mcolor(gs0)  mlcolor(black) ciopts(recast(rspike) color(black)) offset(.05) label("High Skill" "Uniqueness") ) ///
				, vert ytitle("Support for Proposal", size(medlarge)) title("", size(large)) legend(cols(1)  subtitle("Perceptions of politicians:") position(4) size(medium) width(25)) ///
				ylabel(0(.05).5,labsize(large) format(%9.2f)) xline(1.5 2.5 3.5, lcolor(gs10) lstyle(dot)) ///
				coeflabels 	(1._at= `" "A: No" "Argument" "'  /// 
							2._at= `" "B: Competence" "Argument" "' ///
							3._at= `" "C: Self-interest" "Argument" "' ///
							4._at= `" "D: Competence" "and Self-interest" "',  labsize(large) ) ///
				caption(" " "Note: Estimates with 95% confidence intervals (Based on model 4, appendix D)." ///
					"          ", span size(medlarge)) ///
						xsize(6.5) ysize(3.5)
			graph export FIG_D3.tif, replace
			
			
				coefplot   	(low_skill_marginalfx,  msymbol(circle) msize(large) mcolor(gs16)  mlcolor(black) ciopts(recast(rspike) color(black)) offset(-.05) label("Low Skill" "Uniqueness")) ///
							(high_skill_marginalfx,  msymbol(circle) msize(large) mcolor(gs0)  mlcolor(black) ciopts(recast(rspike) color(black)) offset(.05) label("High Skill" "Uniqueness") ) ///
							, vert ytitle("Marginal Effects", size(medlarge)) title("", size(large)) legend(cols(1)  subtitle("Perceptions of politicians:") position(4) size(medium) width(25)) ///
							ylabel(-0.12(.02).05,labsize(large) format(%9.2f)) xline(1.5 2.5 3.5, lcolor(gs10) lstyle(dot)) baselevels yline(0) ///
							coeflabels 	(1.Conditions= `" "A: No" "Argument" "'  /// 
										2.Conditions= `" "B: Competence" "Argument" "' ///
										3.Conditions= `" "C: Self-interest" "Argument" "' ///
										4.Conditions= `" "D: Competence" "and Self-interest" "',  labsize(large) ) ///
							caption(" " "Note: Estimates with 95% confidence intervals (Based on model 4, appendix D)." ///
								"          ", span size(medlarge)) ///
									xsize(6.5) ysize(3.5)
						graph export FIG_D4.tif, replace
			
	
	*H4B - INTERACTION WITH IMPORTANCE OF COMPETENCE (model 5)
	reg Support_increase i.Conditions##c.imp_competence
	eststo model_5
	*reg Support_increase i.Conditions##c.imp_competence Age Female inequality_attitude Trust_index warmth competence  imp_warmth imp_competence
	margins, dydx(imp_competence)
	margins, dydx(imp_competence) at(Conditions=(1 2 3 4)) pwcompare(effects groups) // H4b NOT supported. Effect of "competence importance" does not differ significantly across groups
	margins, dydx(imp_competence) at(Conditions=(1 2 3 4)) post
	eststo h4b
		
	sum imp_competence, detail
		
	estimates restore model_5
	margins, at(Conditions=(1 2 3 4) imp_competence=.46862) post // 
	eststo low_skill
	
			estimates restore model_5
			margins, dydx(Conditions) at(imp_competence=.46862) post // 
			eststo low_skill_marginalfx
	
	estimates restore model_5
	margins, at(Conditions=(1 2 3 4) imp_competence=.8900236) post // 
	eststo high_skill
	
			estimates restore model_5
			margins, dydx(Conditions) at(imp_competence=.8900236) post // 
			eststo high_skill_marginalfx

	
	coefplot   	(low_skill,  msymbol(circle) msize(large) mcolor(gs16)  mlcolor(black) ciopts(recast(rspike) color(black)) offset(-.025) label("Low importance" "of competence")) ///
				(high_skill,  msymbol(circle) msize(large) mcolor(gs0)  mlcolor(black) ciopts(recast(rspike) color(black)) offset(.025) label("High importance" "of competence") ) ///
				, vert ytitle("Support for Proposal", size(medlarge)) title("", size(large)) legend(cols(1)  subtitle("Perceptions of politicians:") position(4) size(medium) width(25)) ///
				ylabel(0(.05).5,labsize(large) format(%9.2f)) xline(1.5 2.5 3.5, lcolor(gs10) lstyle(dot)) ///
				coeflabels 	(1._at= `" "A: No" "Argument" "'  /// 
							2._at= `" "B: Competence" "Argument" "' ///
							3._at= `" "C: Self-interest" "Argument" "' ///
							4._at= `" "D: Competence" "and Self-interest" "',  labsize(large) ) ///
				caption(" " "Note: Estimates with 95% confidence intervals (Based on model 5, appendix D)." ///
					"          ", span size(medlarge)) ///
						xsize(6.5) ysize(3.5)
			graph export FIG_D5.tif, replace	
			
			
			
				coefplot   	(low_skill_marginalfx,  msymbol(circle) msize(large) mcolor(gs16)  mlcolor(black) ciopts(recast(rspike) color(black)) offset(-.05) label("Low importance" "of competence")) ///
							(high_skill_marginalfx,  msymbol(circle) msize(large) mcolor(gs0)  mlcolor(black) ciopts(recast(rspike) color(black)) offset(.05) label("High importance" "of competence") ) ///
							, vert ytitle("Marginal Effects", size(medlarge)) title("", size(large)) legend(cols(1)  subtitle("Perceptions of politicians:") position(4) size(medium) width(25)) ///
							ylabel(-0.12(.02).05,labsize(large) format(%9.2f)) xline(1.5 2.5 3.5, lcolor(gs10) lstyle(dot)) baselevels yline(0) ///
							coeflabels 	(1.Conditions= `" "A: No" "Argument" "'  /// 
										2.Conditions= `" "B: Competence" "Argument" "' ///
										3.Conditions= `" "C: Self-interest" "Argument" "' ///
										4.Conditions= `" "D: Competence" "and Self-interest" "',  labsize(large) ) ///
							caption(" " "Note: Estimates with 95% confidence intervals (Based on model 5, appendix D)." ///
								"          ", span size(medlarge)) ///
									xsize(6.5) ysize(3.5)
						graph export FIG_D6.tif, replace	
		
		
	*H4C - INTERACTION WITH IMPORTANCE OF WARMTH (model 6)
	reg Support_increase i.Conditions##c.imp_warmth
	eststo model_6
	*reg Support_increase i.Conditions##c.imp_warmth Age Female inequality_attitude Trust_index warmth competence  imp_warmth imp_competence
	margins, dydx(imp_warmth)
	margins, dydx(imp_warmth) at(Conditions=(1 2 3 4)) pwcompare(effects groups) // H4c NOT supported. Effect of "warmth importance" does not differ significantly across groups
	margins, dydx(imp_warmth) at(Conditions=(1 2 3 4)) post
	eststo h4c

	sum imp_warmth, detail
		
	estimates restore model_6
	margins, at(Conditions=(1 2 3 4) imp_warmth=.5123078) post // 
	eststo low_skill
	
		estimates restore model_6
		margins, dydx(Conditions) at(imp_warmth=.5123078) post // 
		eststo low_skill_marginalfx
	
	estimates restore model_6
	margins, at(Conditions=(1 2 3 4) imp_warmth=.8404014) post // 
	eststo high_skill
	
		estimates restore model_6
		margins, dydx(Conditions) at(imp_warmth=.8404014) post // 
		eststo high_skill_marginalfx
	

	coefplot   	(low_skill,  msymbol(circle) msize(large) mcolor(gs16)  mlcolor(black) ciopts(recast(rspike) color(black)) offset(-.05) label("Low importance" "of warmth")) ///
				(high_skill,  msymbol(circle) msize(large) mcolor(gs0)  mlcolor(black) ciopts(recast(rspike) color(black)) offset(.05) label("High importance" "of warmth") ) ///
				, vert ytitle("Support for Proposal", size(medlarge)) title("", size(large)) legend(cols(1)  subtitle("Perceptions of politicians:") position(4) size(medium) width(25)) ///
				ylabel(0(.05).5,labsize(large) format(%9.2f)) xline(1.5 2.5 3.5, lcolor(gs10) lstyle(dot)) ///
				coeflabels 	(1._at= `" "A: No" "Argument" "'  /// 
							2._at= `" "B: Competence" "Argument" "' ///
							3._at= `" "C: Self-interest" "Argument" "' ///
							4._at= `" "D: Competence" "and Self-interest" "',  labsize(large) ) ///
				caption(" " "Note: Estimates with 95% confidence intervals (Based on model 6, appendix D)." ///
					"          ", span size(medlarge)) ///
						xsize(6.5) ysize(3.5)
			graph export FIG_D7.tif, replace
			
			
			
				coefplot   	(low_skill_marginalfx,  msymbol(circle) msize(large) mcolor(gs16)  mlcolor(black) ciopts(recast(rspike) color(black)) offset(-.05) label("Low importance" "of warmth")) ///
							(high_skill_marginalfx,  msymbol(circle) msize(large) mcolor(gs0)  mlcolor(black) ciopts(recast(rspike) color(black)) offset(.05) label("High importance" "of warmth") ) ///
							, vert ytitle("Marginal Effects", size(medlarge)) title("", size(large)) legend(cols(1)  subtitle("Perceptions of politicians:") position(4) size(medium) width(25)) ///
							ylabel(-0.12(.02).05,labsize(large) format(%9.2f)) xline(1.5 2.5 3.5, lcolor(gs10) lstyle(dot)) baselevels yline(0) ///
							coeflabels 	(1.Conditions##c= `" "A: No" "Argument" "'  /// 
										2.Conditions= `" "B: Competence" "Argument" "' ///
										3.Conditions= `" "C: Self-interest" "Argument" "' ///
										4.Conditions= `" "D: Competence" "and Self-interest" "',  labsize(large) ) ///
							caption(" " "Note: Estimates with 95% confidence intervals (Based on model 6, appendix D)." ///
								"          ", span size(medlarge)) ///
									xsize(6.5) ysize(3.5)
						graph export FIG_D8.tif, replace
			
			
	*H4D - INTERACTION WITH COMPETENCE (model 7)
	reg Support_increase i.Conditions##c.competence
	eststo model_7
	*reg Support_increase i.Conditions##c.competence Age Female inequality_attitude Trust_index warmth competence  imp_warmth imp_competence
	margins, dydx(competence)
	margins, dydx(competence) at(Conditions=(1 2 3 4)) pwcompare(effects groups) // Some differences, but not as predicted by H4D
	margins, dydx(competence) at(Conditions=(1 2 3 4)) post
	eststo h4d
	
	sum competence, detail
		
	estimates restore model_7
	margins, at(Conditions=(1 2 3 4) competence=.3748278) post
	eststo low_competence

			estimates restore model_7
			margins, dydx(Conditions) at(competence=.3748278) post
			eststo low_competence_marginalfx
	
	estimates restore model_7
	margins, at(Conditions=(1 2 3 4) competence=.7501256) post
	eststo high_competence
	
				estimates restore model_7
				margins, dydx(Conditions) at(competence=.7501256) post
				eststo high_competence_marginalfx
	
	
	coefplot   	(low_competence,  msymbol(circle) msize(large) mcolor(gs16)  mlcolor(black) ciopts(recast(rspike) color(black)) offset(-.025) label(Low competence)) ///
				(high_competence,  msymbol(circle) msize(large) mcolor(gs0)  mlcolor(black) ciopts(recast(rspike) color(black)) offset(.025) label(High competence) ) ///
				, vert ytitle("Support for Proposal", size(medlarge)) title("", size(large)) legend(cols(1)  subtitle("Perceptions of politicians:") position(4) size(medium) width(25)) ///
				ylabel(0(.05).5,labsize(large) format(%9.2f)) xline(1.5 2.5 3.5, lcolor(gs10) lstyle(dot)) ///
				coeflabels 	(1._at= `" "A: No" "Argument" "'  /// 
							2._at= `" "B: Competence" "Argument" "' ///
							3._at= `" "C: Self-interest" "Argument" "' ///
							4._at= `" "D: Competence" "and Self-interest" "',  labsize(large) ) ///
				caption(" " "Note: Estimates with 95% confidence intervals (Based on model 7, appendix D)." ///
					"          ", span size(medlarge)) ///
						xsize(6.5) ysize(3.5)
				graph export FIG_2.eps, replace fontface(Garamond)
			
			
				coefplot   	(low_competence_marginalfx,  msymbol(circle) msize(large) mcolor(gs16)  mlcolor(black) ciopts(recast(rspike) color(black)) offset(-.05) label(Low competence)) ///
							(high_competence_marginalfx,  msymbol(circle) msize(large) mcolor(gs0)  mlcolor(black) ciopts(recast(rspike) color(black)) offset(.05) label(High competence) ) ///
							, vert ytitle("Marginal Effects", size(medlarge)) title("", size(large)) legend(cols(1)  subtitle("Perceptions of politicians:") position(4) size(medium) width(25)) ///
							ylabel(-0.12(.02).05,labsize(large) format(%9.2f)) xline(1.5 2.5 3.5, lcolor(gs10) lstyle(dot)) baselevels yline(0) ///
							coeflabels 	(1.Conditions= `" "A: No" "Argument" "'  /// 
										2.Conditions= `" "B: Competence" "Argument" "' ///
										3.Conditions= `" "C: Self-interest" "Argument" "' ///
										4.Conditions= `" "D: Competence" "and Self-interest" "',  labsize(large) ) ///
							caption(" " "Note: Estimates with 95% confidence intervals (Based on model 7, appendix D)." ///
								"          ", span size(medlarge)) ///
									xsize(6.5) ysize(3.5)
							graph export FIG_D9.tif, replace	
	
	
	*H4E INTERACTION WITH WARMTH (model 8)
	reg Support_increase i.Conditions##c.warmth 
	eststo model_8
	*reg Support_increase i.Conditions##c.warmth Age Female inequality_attitude Trust_index warmth competence  imp_warmth imp_competence
	margins, dydx(warmth)
	margins, dydx(warmth) at(Conditions=(1 2 3 4)) pwcompare(effects groups) // Some differences, but not as predicted by H4E
	margins, dydx(warmth) at(Conditions=(1 2 3 4)) post
	eststo h4e
	
	sum warmth, detail
		
	estimates restore model_8
	margins, at(Conditions=(1 2 3 4) warmth=.3129154) post // .2493672 .3129154
	eststo low_warmth

			estimates restore model_8
			margins, dydx(Conditions) at(warmth=.3129154) post // .2493672 .3129154
			eststo low_warmth_marginalfx
	
	
	estimates restore model_8
	margins, at(Conditions=(1 2 3 4) warmth=.6393404) post // .6974536 .6393404
	eststo high_warmth
	
	
			estimates restore model_8
			margins, dydx(Conditions) at(warmth=.6393404) post // .6974536 .6393404
			eststo high_warmth_marginalfx
			

	coefplot   	(low_warmth,  msymbol(circle) msize(large) mcolor(gs16)  mlcolor(black) ciopts(recast(rspike) color(black)) offset(-.025) label(Low warmth)) ///
				(high_warmth,  msymbol(circle) msize(large) mcolor(gs0)  mlcolor(black) ciopts(recast(rspike) color(black)) offset(.025) label(High warmth) ) ///
				, vert ytitle("Support for Proposal", size(medlarge)) title("", size(large)) legend(cols(1)  subtitle("Perceptions of politicians:") position(4) size(medium) width(25)) ///
				ylabel(0(.05).5,labsize(large) format(%9.2f)) xline(1.5 2.5 3.5, lcolor(gs10) lstyle(dot)) ///
				coeflabels 	(1._at= `" "A: No" "Argument" "'  /// 
							2._at= `" "B: Competence" "Argument" "' ///
							3._at= `" "C: Self-interest" "Argument" "' ///
							4._at= `" "D: Competence" "and Self-interest" "',  labsize(large) ) ///
				caption(" " "Note: Estimates with 95% confidence intervals (Based on model 8, appendix D)." ///
					"          ", span size(medlarge)) ///
						xsize(6.5) ysize(3.5)
			graph export FIG_3.eps, replace fontface(Garamond)
			
			
			coefplot   	(low_warmth_marginalfx,  msymbol(circle) msize(large) mcolor(gs16)  mlcolor(black) ciopts(recast(rspike) color(black)) offset(-.05) label(Low warmth)) ///
						(high_warmth_marginalfx,  msymbol(circle) msize(large) mcolor(gs0)  mlcolor(black) ciopts(recast(rspike) color(black)) offset(.05) label(High warmth) ) ///
						, vert ytitle("Marginal Effects", size(medlarge)) title("", size(large)) legend(cols(1)  subtitle("Perceptions of politicians:") position(4) size(medium) width(25)) ///
						ylabel(-0.12(.02).05,labsize(large) format(%9.2f)) xline(1.5 2.5 3.5, lcolor(gs10) lstyle(dot)) baselevels yline(0) ///
						coeflabels 	(1.Conditions= `" "A: No" "Argument" "'  /// 
									2.Conditions= `" "B: Competence" "Argument" "' ///
									3.Conditions= `" "C: Self-interest" "Argument" "' ///
									4.Conditions= `" "D: Competence" "and Self-interest" "',  labsize(large) ) ///
						caption(" " "Note: Estimates with 95% confidence intervals (Based on model 8, appendix D)." ///
							"          ", span size(medlarge)) ///
								xsize(6.5) ysize(3.5)
						graph export FIG_D10.tif, replace			
			
			
			
			
			
			

*** EXPLORATORY MODELS ON ASSOCIATIONS ***	


reg 	Support_increase i.Conditions Female Age  inequality_attitude Trust_index warmth competence imp_warmth imp_competence skill_uniq_politician  
		eststo Exploratory

		coefplot(Exploratory, msymbol(circle) msize(medlarge) mcolor(gs10)  mlcolor(black) ciopts(recast(rspike) color(black)) ) ///
				, title(" ", size(large)) xline(0) ///
				drop(1.Conditions 2.Conditions 3.Conditions 4.Conditions Age Female _cons) /// 
				order(warmth imp_warmth . competence imp_competence .  skill_uniq_politician . inequality_attitude Trust_index) ///
				coeflabels 		(warmth="Warmth" imp_warmth="Importance of Warmth" competence="Competence" imp_competence="Importance of Competence" ///
								skill_uniq_politician="Skill Uniqueness of Politicians" inequality_attitude="Inequality Attitude (Aversion)" ///
								Trust_index="Trust in politicians",  labsize(medlarge) ) ///
				caption("Note: Estimates with 95% confidence intervals (Based on model 3, appendix D)." ///
					"          ", span size(medium)) ///
						xsize(6.5) ysize(3.5)
			graph export FIG_4.eps, replace fontface(Garamond)

pwcorr warmth competence skill_uniq_politician, sig 

	
	
	
************************************************
***TABLES***************************************
************************************************


esttab 	Primary Supplementary Exploratory using regression_table1.rtf, ///
		r2 b(2) se(2) compress wide label replace interaction(" x ") stardetach ///
		refcat(1.Conditions "{\i Experimental Conditions:}" Age "{\i Covariates:}", nolabel)  ///
		mtitles("Primary model" "Supplementary model" ) ///
		note("Notes: OLS regression coefficients (and standard errors).")

esttab 	h4a using regression_table2.rtf, ///
		r2 b(2) se(2) compress wide label replace interaction(" x ") stardetach ///
		refcat(1.Conditions "{\i Experimental Conditions:}" skill_uniq_politician " ", nolabel)  ///
		mtitles("Skill  Uniqueness") ///
		note("Notes: OLS regression coefficients (and standard errors).")		
		
esttab 	h4b h4c using regression_table3.rtf, ///
		r2 b(2) se(2) compress wide label replace interaction(" x ") stardetach ///
		refcat(1.Conditions "{\i Experimental Conditions:}" imp_competence " " imp_warmth " ", nolabel)  ///
		mtitles("Competence Importance" "Warmth Importance") ///
		note("Notes: OLS regression coefficients (and standard errors).")


esttab 	h4d h4e using regression_table4.rtf, ///
		r2 b(2) se(2) compress wide label replace interaction(" x ") stardetach ///
		refcat(1.Conditions "{\i Experimental Conditions:}" competence " " warmth " ", nolabel)  ///
		mtitles("Perceived Competence" "Perceived Warmth") ///
		note("Notes: OLS regression coefficients (and standard errors).")

	

****************
***Robustness***
****************

tab Support_increase 
sum warmth competence, detail
tab Support_increase if  warmth<.46838
tab Support_increase if  competence<.5710443

*What happens if we rerun model 7 (competence) as a tobit to account for floor effect?
tobit Support_increase i.Conditions##c.competence, ll ul
eststo tobit_competence
	margins, dydx(competence)
	margins, dydx(competence) at(Conditions=(1 2 3 4)) pwcompare(effects groups) // 
	margins, dydx(competence) at(Conditions=(1 2 3 4)) post
esttab tobit_competence 	

*What happens if we rerun model 8 (warmth) as a tobit to account for floor effect?
tobit Support_increase i.Conditions##c.warmth, ll ul
eststo tobit_warmth
	margins, dydx(warmth)
	margins, dydx(warmth) at(Conditions=(1 2 3 4)) pwcompare(effects groups) // 
	margins, dydx(warmth) at(Conditions=(1 2 3 4)) post
	***similar results	

esttab 	tobit_competence tobit_warmth using tobit_table.rtf,  scalars(N_lc N_unc N_rc) pr2 b(2) se(2) compress wide label replace interaction(" x ") stardetach ///
		refcat(1.Conditions "{\i Experimental Conditions:}" competence " " warmth " ", nolabel)  ///
		mtitles("Perceived Competence" "Perceived Warmth") ///
		note("Notes: Tobit regression coefficients (and standard errors).")


***********************************
***THE END*************************
***********************************
